package com.dhcc.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dhcc.domain.Stock;

import io.lettuce.core.dynamic.annotation.Param;

@Mapper
public interface StockMapper extends BaseMapper<Stock>{

	@Update("update stock set count = (count - #{count}) where product_code = #{productCode} and count >= #{count}")
	int updateStock(@Param("count") Integer count,@Param("productCode") String productCode);
}
